package com.guinea.skoru.service;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import org.apache.struts.action.ActionForm;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ReflectionUtils;

import com.guinea.core.utils.BeanUtils;
import com.guinea.core.utils.StringUtils;
import com.guinea.skoru.entity.SkoruApply;
import com.guinea.skoru.entity.SkoruExperience;
import com.guinea.skoru.entity.SkoruRegion;
import com.guinea.skoru.entity.SkoruResume;
import com.guinea.skoru.entity.SkoruShareholder;
import com.guinea.skoru.form.SkoruApplyForm;
import com.guinea.skosite.vo.SkoruApplyWordVo;
import com.guinea.svw.entity.City;
import com.guinea.svw.entity.District;
import com.guinea.svw.entity.Province;
import com.guinea.svw.service.CommonManager;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class SkoruApplyWordManager {
	protected Logger logger = LoggerFactory.getLogger(getClass());
	public final String CHECKED = "<w:sym w:font=\"Wingdings\" w:char=\"F0FE\"/>";

	public final String NOTCHECKED = "<w:sym w:font=\"Wingdings\" w:char=\"F0A8\"/>";

	public final String YES = "是";

	public final String NO = "否";

	public final String MAN = "男";

	public final String FEMAIL = "女";


	SkoruApplyManager skoruApplyManager;

	SkoruRegionManager skoruRegionManager;
	SkoruExperienceManager skoruExperienceManager;
	private CommonManager commonManager;

	public SkoruRegionManager getSkoruRegionManager() {
		return skoruRegionManager;
	}

	public void setSkoruRegionManager(SkoruRegionManager skoruRegionManager) {
		this.skoruRegionManager = skoruRegionManager;
	}

	public SkoruApplyManager getSkoruApplyManager() {
		return skoruApplyManager;
	}

	public void setSkoruApplyManager(SkoruApplyManager skoruApplyManager) {
		this.skoruApplyManager = skoruApplyManager;
	}


	public SkoruExperienceManager getSkoruExperienceManager() {
		return skoruExperienceManager;
	}

	public void setSkoruExperienceManager(
			SkoruExperienceManager skoruExperienceManager) {
		this.skoruExperienceManager = skoruExperienceManager;
	}

	public CommonManager getCommonManager() {
		return commonManager;
	}

	public void setCommonManager(CommonManager commonManager) {
		this.commonManager = commonManager;
	}

	/**
	 * @param args
	 * @throws UnsupportedEncodingException
	 */
	public void writeWord(Long applyId,Long regionId,Writer out) throws UnsupportedEncodingException {
		Configuration configuration = new Configuration();
		configuration.setDefaultEncoding("UTF-8");
		configuration.setClassForTemplateLoading(SkoruApplyWordManager.class, "");
		Template t = null;
		try {
			//要装载的模板
			t = configuration.getTemplate("skoru_template.doc");
		} catch (IOException e) {
			e.printStackTrace();
		}


		SkoruApplyForm form = null;
		if (form == null) {
			form = new SkoruApplyForm();
			form.commonReset();
		}
		bindApplyForm(form, applyId, regionId);
		SkoruApplyWordVo a = new SkoruApplyWordVo();
		List shareholders = getSkoruApplyManager().getShareholdersByApplyId(
				applyId);
		List resumes = getSkoruApplyManager().getResumesByApplyId(applyId);
		for (Iterator iter = resumes.iterator(); iter.hasNext();) {
			SkoruResume resume = (SkoruResume) iter.next();
			List experiences = getSkoruExperienceManager().findExperiences(resume.getId());
			if("1".equals(resume.getTypeCode()))
				a.setExperiences1(getXmlExperiences(experiences));
			if("2".equals(resume.getTypeCode()))
				a.setExperiences2(getXmlExperiences(experiences));
			if("3".equals(resume.getTypeCode()))
				a.setExperiences3(getXmlExperiences(experiences));
		}
		a.setShareholders1(getXmlShareholder(shareholders, "1"));
		a.setShareholders2(getXmlShareholder(shareholders, "2"));
		a.setShareholders3(getXmlShareholder3(shareholders, "3"));


		List provinces = getCommonManager().getProvinces();
		List cities = getCommonManager().getCities();
		List districts = getCommonManager().getDistricts();
		applyToWord(a, form, provinces, cities, districts);

		HashMap m = new HashMap();
		m.put("a", a);

		try {
			t.process(m, out);
		} catch (TemplateException e) {
			logger.error("error write word, application id:" + a.getId(),e);
		} catch (IOException e) {
			logger.error("error write word, application id:" + a.getId(),e);
		}

	}

	void applyToWord(SkoruApplyWordVo w, SkoruApplyForm f, List provinces,
			List cities, List districts) {
		try {
			BeanUtils.copyProperties(w, f);
		} catch (Exception e) {
			ReflectionUtils.handleReflectionException(e);
		}
		// 申请年月
		if (f.getSubmitDate() != null) {
			DateTime c = new DateTime(f.getSubmitDate());
			w.setYear(DateTimeFormat.forPattern("yy").print(c));
			w.setMonth(DateTimeFormat.forPattern("MM").print(c));
		}

		// 注册地址
		if (f.getRegisterProvinceId() != null)
			for (Iterator iter = provinces.iterator(); iter.hasNext();) {
				Province province = (Province) iter.next();
				if (province.getCode() != null
						&& province.getCode().equals(f.getRegisterProvinceId())) {
					w.setRegisterProvince(province.getAbbr());
				}
			}
		if (f.getRegisterCityId() != null)
			for (Iterator iter = cities.iterator(); iter.hasNext();) {
				City city = (City) iter.next();
				if (city.getCode() != null
						&& city.getCode().equals(f.getRegisterCityId())) {
					w.setRegisterCity(city.getName());
				}
			}
		if (f.getRegisterDistrictId() != null)
			for (Iterator iter = districts.iterator(); iter.hasNext();) {
				District district = (District) iter.next();
				if (district.getCode() != null
						&& district.getCode().equals(f.getRegisterDistrictId())) {
					w.setRegisterDistrict(district.getName());
				}
			}
		// 联系地址
		if (f.getContactProvinceId() != null)
			for (Iterator iter = provinces.iterator(); iter.hasNext();) {
				Province province = (Province) iter.next();
				if (province.getCode() != null
						&& province.getCode().equals(f.getContactProvinceId())) {
					w.setContactProvince(province.getAbbr());
				}
			}
		if (f.getContactCityId() != null)
			for (Iterator iter = cities.iterator(); iter.hasNext();) {
				City city = (City) iter.next();
				if (city.getCode() != null
						&& city.getCode().equals(f.getContactCityId())) {
					w.setContactCity(city.getName());
				}
			}
		if (f.getContactDistrictId() != null)
			for (Iterator iter = districts.iterator(); iter.hasNext();) {
				District district = (District) iter.next();
				if (district.getCode() != null
						&& district.getCode().equals(f.getContactDistrictId())) {
					w.setContactDistrict(district.getName());
				}
			}
		// 投资区域
		if (f.getProvinceId() != null)
			for (Iterator iter = provinces.iterator(); iter.hasNext();) {
				Province province = (Province) iter.next();
				if (province.getCode() != null
						&& province.getCode().equals(f.getProvinceId())) {
					w.setProvince(province.getAbbr());
				}
			}
		if (f.getCityId() != null)
			for (Iterator iter = cities.iterator(); iter.hasNext();) {
				City city = (City) iter.next();
				if (city.getCode() != null
						&& city.getCode().equals(f.getCityId())) {
					w.setCity(city.getName());
				}
			}
		if (f.getDistrictId() != null)
			for (Iterator iter = districts.iterator(); iter.hasNext();) {
				District district = (District) iter.next();
				if (district.getCode() != null
						&& district.getCode().equals(f.getDistrictId())) {
					w.setDistrict(district.getName());
				}
			}
		// 是否开户银行
		String isOpenBankShow1 = NO;
		if ("1".equals(f.getIsOpenBank1()))
			isOpenBankShow1 = YES;
		w.setIsOpenBankShow1(isOpenBankShow1);
		String isOpenBankShow2 = NO;
		if ("1".equals(f.getIsOpenBank2()))
			isOpenBankShow2 = YES;
		w.setIsOpenBankShow2(isOpenBankShow2);
		String isOpenBankShow3 = NO;
		if ("1".equals(f.getIsOpenBank3()))
			isOpenBankShow3 = YES;
		w.setIsOpenBankShow3(isOpenBankShow3);
		// 性别
		String gender1 = MAN;
		if ("2".equals(f.getGender1()))
			gender1 = FEMAIL;
		w.setGenderShow1(gender1);
		String gender2 = MAN;
		if ("2".equals(f.getGender2()))
			gender2 = FEMAIL;
		w.setGenderShow2(gender2);
		String gender3 = MAN;
		if ("2".equals(f.getGender3()))
			gender3 = FEMAIL;
		w.setGenderShow3(gender3);

		String isNewShowHallShow = "新建";
		if ("1".equals(f.getIsNewShowHall()))
			isNewShowHallShow = "新建";
		if ("0".equals(f.getIsNewShowHall()))
			isNewShowHallShow = "改建";
		w.setIsNewShowHallShow(isNewShowHallShow);

		String isNewWorkShopShow = "新建";
		if ("1".equals(f.getIsNewWorkShop()))
			isNewWorkShopShow = "新建";
		if ("0".equals(f.getIsNewWorkShop()))
			isNewWorkShopShow = "改建";
		w.setIsNewWorkShopShow(isNewWorkShopShow);

		String hasOtherBuildingShow = "不存在";
		if ("1".equals(f.getHasOtherBuilding()))
			hasOtherBuildingShow = "存在";
		if ("0".equals(f.getHasOtherBuilding()))
			hasOtherBuildingShow = "不存在";
		w.setHasOtherBuildingShow(hasOtherBuildingShow);

		String hasGuaranteeShow = "无";
		if ("1".equals(f.getHasGuarantee()))
			hasGuaranteeShow = "有";
		if ("0".equals(f.getHasGuarantee()))
			hasGuaranteeShow = "无";
		w.setHasGuaranteeShow(hasGuaranteeShow);

		String isPolicyAllowedShow = "允许";
		if ("1".equals(f.getIsPolicyAllowed()))
			isPolicyAllowedShow = "允许";
		if ("0".equals(f.getIsPolicyAllowed()))
			isPolicyAllowedShow = "不允许";
		w.setIsPolicyAllowedShow(isPolicyAllowedShow);
		// 经济性质等
		w.setEconomicNatureOptions(getOptions(5, f.getEconomicNatureCode()));
		w.setFinancingMethodOptions(getOptions(4, f.getFinancingMethodCode()));
		w.setIsAuthenticOptions(getOptions(2, f.getIsAuthentic()));
		w.setHasQualificationGradeOptions(getOptions(2, f
				.getHasQualificationGrade()));
		w.setSourceOptions(getOptions(5, f.getSourceCode()));
		w.setPropertyOptions(getOptions(4, f.getPropertyCode()));

	}

	String[] getOptions(int length, String code) {
		String[] result = new String[length];
		for (int i = 0; i < result.length; i++)
			result[i] = NOTCHECKED;
		if (code != null) {
			int checkNum = Integer.parseInt(code);
			if (checkNum > 0 && checkNum < length + 1)
				result[checkNum - 1] = CHECKED;
		}
		return result;
	}
	String getXmlExperiences(List experiences) {
		String xml = "";
		for (Iterator iter = experiences.iterator(); iter.hasNext();) {
			SkoruExperience experience = (SkoruExperience) iter.next();
			xml += "<w:tr wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"00542CC9\">";
			xml += "<w:trPr>";
			xml += "<w:gridBefore w:val=\"1\"/>";
			xml += "</w:trPr>";
			xml += "<w:tc>";
			xml += "<w:tcPr>";
			xml += "<w:tcW w:w=\"1908\" w:type=\"dxa\"/>";
			xml += "<w:gridSpan w:val=\"2\"/>";
			xml += "</w:tcPr>";
			xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"00542CC9\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"007E58C2\">";
			xml += "<w:pPr>";
			xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "</w:rPr>";
			xml += "</w:pPr>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<aml:annotation aml:id=\"30\" aml:author=\"USER\" aml:createdate=\"2011-03-22T16:58:00Z\" w:type=\"Word.Insertion\">";
			xml += "<aml:content>";
			xml += "<w:r wsp:rsidR=\"00CB221B\" wsp:rsidRPr=\"00CB221B\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>"+StringUtils.trimToEmpty(experience.getPeriod())+"</w:t>";
			xml += "</w:r>";
			xml += "</aml:content>";
			xml += "</aml:annotation>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "</w:p>";
			xml += "</w:tc>";
			xml += "<w:tc>";
			xml += "<w:tcPr>";
			xml += "<w:tcW w:w=\"5636\" w:type=\"dxa\"/>";
			xml += "<w:gridSpan w:val=\"4\"/>";
			xml += "</w:tcPr>";
			xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"00542CC9\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"007E58C2\">";
			xml += "<w:pPr>";
			xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "</w:rPr>";
			xml += "</w:pPr>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<aml:annotation aml:id=\"31\" aml:author=\"USER\" aml:createdate=\"2011-03-22T16:58:00Z\" w:type=\"Word.Insertion\">";
			xml += "<aml:content>";
			xml += "<w:r wsp:rsidR=\"00CB221B\" wsp:rsidRPr=\"00CB221B\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>"+StringUtils.trimToEmpty(experience.getCorp())+"</w:t>";
			xml += "</w:r>";
			xml += "</aml:content>";
			xml += "</aml:annotation>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "</w:p>";
			xml += "</w:tc>";
			xml += "<w:tc>";
			xml += "<w:tcPr>";
			xml += "<w:tcW w:w=\"1476\" w:type=\"dxa\"/>";
			xml += "<w:gridSpan w:val=\"2\"/>";
			xml += "</w:tcPr>";
			xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"00542CC9\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"007E58C2\">";
			xml += "<w:pPr>";
			xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "</w:rPr>";
			xml += "</w:pPr>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<aml:annotation aml:id=\"32\" aml:author=\"USER\" aml:createdate=\"2011-03-22T16:59:00Z\" w:type=\"Word.Insertion\">";
			xml += "<aml:content>";
			xml += "<w:r wsp:rsidR=\"00CB221B\" wsp:rsidRPr=\"00CB221B\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>"+StringUtils.trimToEmpty(experience.getJob())+"</w:t>";
			xml += "</w:r>";
			xml += "</aml:content>";
			xml += "</aml:annotation>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:rPr>";
			xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
			xml += "<wx:font wx:val=\"Arial\"/>";
			xml += "<w:sz-cs w:val=\"21\"/>";
			xml += "<w:u w:val=\"single\"/>";
			xml += "</w:rPr>";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
			xml += "<w:t>  </w:t>";
			xml += "</w:r>";
			xml += "</w:p>";
			xml += "</w:tc>";
			xml += "</w:tr>";

		}
		return xml;
	}
	String getXmlShareholder(List shareholders, String typeCode) {
		String xml = "";
		int count = 0;
		for (Iterator iter = shareholders.iterator(); iter.hasNext();) {
			SkoruShareholder shareholder = (SkoruShareholder) iter.next();
			count ++ ;
			if(typeCode.equals(shareholder.getTypeCode())){
				xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"00D72AE2\" wsp:rsidRDefault=\"001436E2\" wsp:rsidP=\"001436E2\">";
				xml += "<w:pPr>";
				xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "</w:pPr>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>股东</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00DD1B18\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\" w:hint=\"fareast\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+count+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>：</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"008D4D1F\" wsp:rsidRPr=\"008D4D1F\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getShareholderName())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00464EC5\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\" w:hint=\"fareast\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>，</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>投入金额：</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F63607\" wsp:rsidRPr=\"00F63607\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getStake())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>万元</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00464EC5\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\" w:hint=\"fareast\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>，</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"宋体\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>占</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F63607\" wsp:rsidRPr=\"00F63607\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getPercent())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00F86229\" wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00D72AE2\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>%</w:t>";
				xml += "</w:r>";
				xml += "</w:p>";

			}
		}
		return xml;
	}
	String getXmlShareholder3(List shareholders, String typeCode) {
		String xml = "";
		xml += "<w:tbl>";
		xml += "<w:tblPr>";
		xml += "<w:tblW w:w=\"0\" w:type=\"auto\"/>";
		xml += "<w:tblInd w:w=\"108\" w:type=\"dxa\"/>";
		xml += "<w:tblBorders>";
		xml += "<w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "<w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "<w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "<w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "<w:insideH w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "<w:insideV w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/>";
		xml += "</w:tblBorders>";
		xml += "<w:tblLook w:val=\"01E0\"/>";
		xml += "</w:tblPr>";
		xml += "<w:tblGrid>";
		xml += "<w:gridCol w:w=\"5565\"/>";
		xml += "<w:gridCol w:w=\"1785\"/>";
		xml += "<w:gridCol w:w=\"1785\"/>";
		xml += "</w:tblGrid>";
		xml += "<w:tr wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:tc>";
		xml += "<w:tcPr>";
		xml += "<w:tcW w:w=\"5565\" w:type=\"dxa\"/>";
		xml += "<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>";
		xml += "<w:vAlign w:val=\"center\"/>";
		xml += "</w:tcPr>";
		xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"001436E2\" wsp:rsidP=\"00BB00D1\">";
		xml += "<w:pPr>";
		xml += "<w:jc w:val=\"center\"/>";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"Arial\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "</w:pPr>";
		xml += "<w:r wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>出资</w:t>";
		xml += "</w:r>";
		xml += "<w:r wsp:rsidR=\"00FE1F21\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>方</w:t>";
		xml += "</w:r>";
		xml += "</w:p>";
		xml += "</w:tc>";
		xml += "<w:tc>";
		xml += "<w:tcPr>";
		xml += "<w:tcW w:w=\"1785\" w:type=\"dxa\"/>";
		xml += "<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>";
		xml += "<w:vAlign w:val=\"center\"/>";
		xml += "</w:tcPr>";
		xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"001436E2\" wsp:rsidP=\"00BB00D1\">";
		xml += "<w:pPr>";
		xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
		xml += "<w:jc w:val=\"center\"/>";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"Arial\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "</w:pPr>";
		xml += "<w:r wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>出资额</w:t>";
		xml += "</w:r>";
		xml += "<w:r wsp:rsidR=\"00FE1F21\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>（万元）</w:t>";
		xml += "</w:r>";
		xml += "</w:p>";
		xml += "</w:tc>";
		xml += "<w:tc>";
		xml += "<w:tcPr>";
		xml += "<w:tcW w:w=\"1785\" w:type=\"dxa\"/>";
		xml += "<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>";
		xml += "<w:vAlign w:val=\"center\"/>";
		xml += "</w:tcPr>";
		xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"001436E2\" wsp:rsidP=\"00BB00D1\">";
		xml += "<w:pPr>";
		xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
		xml += "<w:jc w:val=\"center\"/>";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"Arial\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "</w:pPr>";
		xml += "<w:r wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>所占比例</w:t>";
		xml += "</w:r>";
		xml += "<w:r wsp:rsidR=\"00FE1F21\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>（</w:t>";
		xml += "</w:r>";
		xml += "<w:r wsp:rsidR=\"00FE1F21\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"Arial\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>%</w:t>";
		xml += "</w:r>";
		xml += "<w:r wsp:rsidR=\"00FE1F21\" wsp:rsidRPr=\"0007490A\">";
		xml += "<w:rPr>";
		xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:cs=\"Arial\"/>";
		xml += "<wx:font wx:val=\"宋体\"/>";
		xml += "<w:sz-cs w:val=\"21\"/>";
		xml += "</w:rPr>";
		xml += "<w:t>）</w:t>";
		xml += "</w:r>";
		xml += "</w:p>";
		xml += "</w:tc>";
		xml += "</w:tr>";
		for (Iterator iter = shareholders.iterator(); iter.hasNext();) {
			SkoruShareholder shareholder = (SkoruShareholder) iter.next();
			if(typeCode.equals(shareholder.getTypeCode())){
				xml += "<w:tr wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\">";
				xml += "<w:tc>";
				xml += "<w:tcPr>";
				xml += "<w:tcW w:w=\"5565\" w:type=\"dxa\"/>";
				xml += "</w:tcPr>";
				xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"00BB00D1\">";
				xml += "<w:pPr>";
				xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "</w:pPr>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00AD35D4\" wsp:rsidRPr=\"00AD35D4\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getShareholderName())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "</w:p>";
				xml += "</w:tc>";
				xml += "<w:tc>";
				xml += "<w:tcPr>";
				xml += "<w:tcW w:w=\"1785\" w:type=\"dxa\"/>";
				xml += "</w:tcPr>";
				xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"00BB00D1\">";
				xml += "<w:pPr>";
				xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "</w:pPr>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00AD35D4\" wsp:rsidRPr=\"00AD35D4\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getStake())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "</w:p>";
				xml += "</w:tc>";
				xml += "<w:tc>";
				xml += "<w:tcPr>";
				xml += "<w:tcW w:w=\"1785\" w:type=\"dxa\"/>";
				xml += "</w:tcPr>";
				xml += "<w:p wsp:rsidR=\"001436E2\" wsp:rsidRPr=\"0007490A\" wsp:rsidRDefault=\"00B66B27\" wsp:rsidP=\"00BB00D1\">";
				xml += "<w:pPr>";
				xml += "<w:spacing w:line=\"360\" w:line-rule=\"auto\"/>";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "</w:rPr>";
				xml += "</w:pPr>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidR=\"00AD35D4\" wsp:rsidRPr=\"00AD35D4\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>"+StringUtils.trimToEmpty(shareholder.getPercent())+"</w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:rPr>";
				xml += "<w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:cs=\"Arial\"/>";
				xml += "<wx:font wx:val=\"Arial\"/>";
				xml += "<w:sz-cs w:val=\"21\"/>";
				xml += "<w:u w:val=\"single\"/>";
				xml += "</w:rPr>";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "<w:r wsp:rsidRPr=\"00382DF9\">";
				xml += "<w:t>  </w:t>";
				xml += "</w:r>";
				xml += "</w:p>";
				xml += "</w:tc>";
				xml += "</w:tr>";
			}
		}
		xml += "</w:tbl>";
		return xml;
	}

	boolean bindApplyForm(SkoruApplyForm applyForm, Long applyId, Long regionId) {
		if (applyForm == null) {
			applyForm = new SkoruApplyForm();
			applyForm.commonReset();
		}
		SkoruApply apply = null;
		SkoruRegion region = null;
		if (applyId == null && regionId == null) {
			// 全部新增

		} else if (regionId == null) {
			// 申请修改，场地新增
			apply = getSkoruApplyManager().getSkoruApply(applyId);
			if (apply == null) {
				return false;
			} else {
				List resumeList = getSkoruApplyManager().getResumesByApplyId(
						regionId);
				// 验证三条履历
				if (resumeList == null || resumeList.size() != 3) {
					return false;
				}
				bindForm(applyForm, apply);
////				创建日期
//				if(applyForm.getSubmitDate() == null)
//					applyForm.setSubmitDate(apply.getCreated());
				bindFormResumes(applyForm, resumeList);
			}
		} else {
			// 申请修改，场地修改
			region = getSkoruRegionManager().getSkoruRegion(regionId);
			apply = null;
			if (region != null)
				apply = getSkoruApplyManager().getSkoruApply(
						region.getApplyId());
			applyId = apply.getId();
			if (apply == null || region == null) {
				return false;
			} else {
				List resumeList = getSkoruApplyManager().getResumesByApplyId(
						applyId);
				// 验证三条履历
				if (resumeList == null || resumeList.size() != 3) {
					return false;
				}
				bindForm(applyForm, apply);
				//创建日期
				applyForm.setSubmitDate(apply.getCreated());
				bindFormResumes(applyForm, resumeList);
				bindForm(applyForm, region);
				applyForm.setRegionId(region.getId());
			}
		}
		return true;
	}

	/**
	 * 将Object内容通过BeanUtils的copyProperties 复制到FormBean中.
	 * 因为BeanUtils中两个参数的顺序很容易搞错，因此封装此函数。
	 */
	protected void bindForm(ActionForm form, Object object) {
		if (object != null) {
			try {
				BeanUtils.copyProperties(form, object);
			} catch (Exception e) {
				ReflectionUtils.handleReflectionException(e);
			}
		}
	}

	private void bindFormResumes(ActionForm form, List resumeList) {
		if (form != null) {
			SkoruApplyForm applyForm = (SkoruApplyForm) form;
			if (resumeList != null)
				for (Iterator iter = resumeList.iterator(); iter.hasNext();) {
					SkoruResume resume = (SkoruResume) iter.next();
					if (resume != null && resume.getTypeCode() != null) {
						if (resume.getTypeCode().equals("1")) {
							// 董事长
							applyForm.setResumeId1(resume.getId());
							applyForm.setBirthDay1(resume.getBirthDay());
							applyForm.setBirthMonth1(resume.getBirthMonth());
							applyForm.setBirthYear1(resume.getBirthYear());
							applyForm.setCellphone1(resume.getCellphone());
							applyForm.setEmail1(resume.getEmail());
							applyForm.setGender1(resume.getGender());
							applyForm.setNote1(resume.getNote());
							applyForm.setOwner1(resume.getOwner());
							applyForm.setSchoolAge1(resume.getSchoolAge());
						} else if (resume.getTypeCode().equals("2")) {
							// 总经理
							applyForm.setResumeId2(resume.getId());
							applyForm.setBirthDay2(resume.getBirthDay());
							applyForm.setBirthMonth2(resume.getBirthMonth());
							applyForm.setBirthYear2(resume.getBirthYear());
							applyForm.setCellphone2(resume.getCellphone());
							applyForm.setEmail2(resume.getEmail());
							applyForm.setGender2(resume.getGender());
							applyForm.setNote2(resume.getNote());
							applyForm.setOwner2(resume.getOwner());
							applyForm.setSchoolAge2(resume.getSchoolAge());
						} else if (resume.getTypeCode().equals("3")) {
							// 意向经理
							applyForm.setResumeId3(resume.getId());
							applyForm.setBirthDay3(resume.getBirthDay());
							applyForm.setBirthMonth3(resume.getBirthMonth());
							applyForm.setBirthYear3(resume.getBirthYear());
							applyForm.setCellphone3(resume.getCellphone());
							applyForm.setEmail3(resume.getEmail());
							applyForm.setGender3(resume.getGender());
							applyForm.setNote3(resume.getNote());
							applyForm.setOwner3(resume.getOwner());
							applyForm.setSchoolAge3(resume.getSchoolAge());
						}
					}
				}
		}
	}
}
